package com.itheima.shuzu;

import java.util.Scanner;

public class Demo6 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        System.out.println("请要求和数的个数:");
        int count=sc.nextInt();
        int[] data=new int[count];
        int sum=0;
        for(int i=0;i<count;i++){
            System.out.println("请输入第"+(i+1)+"个1到100的整数:");
            int a=sc.nextInt();
            while(a>100||a<0){
                System.out.println("输入错误,请重新输入:");
                a=sc.nextInt();
            }
            sum+=a;
        }
        System.out.println("求和的总数sum = " + sum);


    }
}
